home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / src / GLperf3.12-src.lha / GLperf / TextX.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-01  |  5.5 KB  |  174 lines

  1. /*
  2.  * (c) Copyright 1995, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED
  4.  * Permission to use, copy, modify, and distribute this software for
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  *
  25.  * US Government Users Restricted Rights
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * Author: John Spitzer, SGI Applied Engineering
  36.  *
  37.  */
  38.  
  39. /* Define calls if using function pointers or not */
  40. #ifdef FUNCTION_PTRS
  41.   #if (COLOR_DIM == 3)
  42.     #define COLOR_CALL   (*color3fv)(srcPtr)
  43.   #else
  44.     #define COLOR_CALL   (*color4fv)(srcPtr)
  45.   #endif
  46.   #define INDEX_CALL   (*indexfv)(srcPtr)
  47.   #ifdef MULTIIMAGE
  48.     #define CALLLISTS_CALL   (*calllists)(charsPerString, type, *imagePtr++);
  49.   #else
  50.     #define CALLLISTS_CALL   (*calllists)(charsPerString, type, image);
  51.   #endif
  52.   #if (RASTERPOS_DIM == 2)
  53.     #define RASTERPOS_CALL   (*rasterPos2fv)(srcPtr);
  54.   #else
  55.     #define RASTERPOS_CALL   (*rasterPos3fv)(srcPtr);
  56.   #endif
  57. #else
  58.   #if (COLOR_DIM == 3)
  59.     #define COLOR_CALL   glColor3fv(srcPtr)
  60.   #else
  61.     #define COLOR_CALL   glColor4fv(srcPtr)
  62.   #endif
  63.   #define INDEX_CALL   glIndexfv(srcPtr)
  64.   #ifdef MULTIIMAGE
  65.     #define CALLLISTS_CALL   glCallLists(charsPerString, type, *imagePtr++);
  66.   #else
  67.     #define CALLLISTS_CALL   glCallLists(charsPerString, type, image);
  68.   #endif
  69.   #if (RASTERPOS_DIM == 2)
  70.     #define RASTERPOS_CALL   glRasterPos2fv(srcPtr);
  71.   #else
  72.     #define RASTERPOS_CALL   glRasterPos3fv(srcPtr);
  73.   #endif
  74. #endif
  75.  
  76. #if (RASTERPOS_DIM == 2)
  77.   #define NEXT_RASTERPOS srcPtr += 2;
  78. #else
  79.   #define NEXT_RASTERPOS srcPtr += 3;
  80. #endif
  81.  
  82. #if (VISUAL == RGB)
  83.   #define COLOR_DATA COLOR_CALL; srcPtr += COLOR_DIM;
  84. #else
  85.   #define COLOR_DATA INDEX_CALL; srcPtr += 1;
  86. #endif
  87. #if (COLOR == PER_RASTERPOS)
  88.   #define RASTERPOS_COLOR_DATA COLOR_DATA
  89. #else
  90.   #define RASTERPOS_COLOR_DATA
  91. #endif
  92.  
  93. void FUNCTION (TestPtr thisTest)
  94. {
  95.     TextPtr this = (TextPtr)thisTest;
  96.     int iterations = this->iterations;
  97.     int numDrawn = this->numDrawn;
  98.     GLuint base = this->base;
  99.     GLenum type = GL_UNSIGNED_BYTE;
  100.     GLsizei charsPerString = this->charsPerString;
  101.     int i,j;
  102.   #ifdef MULTIIMAGE
  103.     int numObjects = this->numObjects;
  104.     int k;
  105.     void **imageData = this->imageData;
  106.     void **imagePtr = imageData;
  107.   #else
  108.     void *image = *(this->imageData);
  109.   #endif
  110.     GLfloat *traversalData = this->traversalData;
  111.     GLfloat *srcPtr = traversalData;
  112.   #ifdef FUNCTION_PTRS
  113.    #ifdef WIN32
  114.     #if (VISUAL == RGB)
  115.      #if (COLOR_DIM == 3)
  116.       void (APIENTRY *color3fv)(const GLfloat*) = glColor3fv;
  117.      #else
  118.       void (APIENTRY *color4fv)(const GLfloat*) = glColor4fv;
  119.      #endif
  120.     #else
  121.      void (APIENTRY *indexfv)(const GLfloat*) = glIndexfv;
  122.     #endif
  123.      void (APIENTRY *calllists)(GLsizei, GLenum, const GLvoid*) = glCallLists;
  124.     #if (RASTERPOS_DIM == 2)
  125.      void (APIENTRY *rasterPos2fv)(const GLfloat*) = glRasterPos2fv;
  126.     #else
  127.      void (APIENTRY *rasterPos3fv)(const GLfloat*) = glRasterPos3fv;
  128.     #endif
  129.    #else
  130.     #if (VISUAL == RGB)
  131.      #if (COLOR_DIM == 3)
  132.       void (*color3fv)(const GLfloat*) = glColor3fv;
  133.      #else
  134.       void (*color4fv)(const GLfloat*) = glColor4fv;
  135.      #endif
  136.     #else
  137.      void (*indexfv)(const GLfloat*) = glIndexfv;
  138.     #endif
  139.      void (*calllists)(GLsizei, GLenum, const GLvoid*) = glCallLists;
  140.     #if (RASTERPOS_DIM == 2)
  141.      void (*rasterPos2fv)(const GLfloat*) = glRasterPos2fv;
  142.     #else
  143.      void (*rasterPos3fv)(const GLfloat*) = glRasterPos3fv;
  144.     #endif
  145.    #endif
  146.   #endif
  147.  
  148.     glListBase(base);
  149.     for (i = iterations; i > 0; i--) {
  150.     for (j = numDrawn; j > 0; j--) {
  151.         RASTERPOS_COLOR_DATA
  152.           #ifdef MULTIIMAGE
  153.         for (k = numObjects; k > 0; k--) {
  154.           #endif
  155.           RASTERPOS_CALL
  156.           CALLLISTS_CALL
  157.           #ifdef MULTIIMAGE
  158.         }
  159.         imagePtr = imageData;
  160.           #endif
  161.         NEXT_RASTERPOS
  162.     }
  163.     srcPtr = traversalData;
  164.     }
  165. }
  166.  
  167. #undef CALLLISTS_CALL
  168. #undef RASTERPOS_CALL
  169. #undef NEXT_RASTERPOS
  170. #undef COLOR_DATA
  171. #undef RASTERPOS_COLOR_DATA
  172. #undef COLOR_CALL
  173. #undef INDEX_CALL
  174.